﻿
using AppEszköz.Log.Service;

namespace AppEszköz.Config
{
    public class ClassicConfigRegistryHelper
    {
        public string ClassicAspRegHelper(string applicationName, string settingsCategory, string key)
        {
            return new ConfigRegistryHelper(applicationName, settingsCategory).GetConfig(key);
        }

        public string Environment()
        {
            return ConfigHelper.GetConfig("Environment");
        }

        public string WriteToLog(int ApplicationID, int LoggingType, string EventDescription, string UserID, string URL, string IPAddress, string details)
        {
            EventTypes et = EventTypes.Diagnostic;
            switch (LoggingType)
            {
                case 0:
                    et = EventTypes.Diagnostic;
                    break;
                case 1:
                    et = EventTypes.Informational;
                    break;
                case 2:
                    et = EventTypes.DataChange;
                    break;
                case 3:
                    et = EventTypes.Security;
                    break;
                case 4:
                    et = EventTypes.Errors;
                    break;
            }
            string[] strArray = new string[1]
            {
        details
            };
            return new LoggingService()
            {
                Url = ConfigRegistryHelper.GetConfig("AppTools_" + this.Environment(), "Web", "ApplicationLoggingURL")
            }.WriteLog(ApplicationID, et, EventDescription, UserID, URL, IPAddress, (object[])strArray);
        }
    }
}